package com.tom.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/date")
    @ResponseBody
    public String date(Date date) {
        System.out.println("日期是" + date.toString());
        return "日期是:" + date.toString();
    }


    @PostMapping("/upload")
    @ResponseBody
    public String upload(@RequestParam MultipartFile file) {
        System.out.println("文件是" + file.toString());
        return "文件是:" + file.getOriginalFilename();
    }

}
